<extend name="Base/common"/>
<block name="body">
    <div class="container">
        <div class="nav">
            <img src="__IMG__/img_1.png" alt="" id="show">
            <h3> 个人信息</h3>
        </div>
        <div class="info_list">
            <ul class="list">
                <li class="clearfix">
                    <span class="left_span">头像</span><img src="{$info.headimgurl}" alt="" class="info_img">
                </li>
            </ul>
            <ul class="list">
                <li class="clearfix list_nobor">
                    <span class="left_span">用户名</span><span class="right_span">{$info.nickname}</span>
                </li>
            </ul>
        </div>

        <div class="info_list">
            <ul class="list">
                <li class="clearfix">
                    <span class="left_span">性别</span><span class="right_span"><if condition="$info['sex'] eq 1">男<else />女</if></span>
                </li>
            </ul>
            <ul class="list">
                <li class="clearfix list_nobor">
                    <span class="left_span">手机</span><span class="right_span">{$info.mobile}</span>
                </li>
            </ul>
        </div>

        <div class="info_list">
            <ul class="list list_reset2">
                <li class="clearfix" >
                    <span class="left_span">二维码</span><span class="right_span"></span>
                </li>
            </ul>
            <ul class="list list_reset">
                <li class="clearfix ">
                    <span class="left_span reset_pwd">修改密码</span><span class="right_span"></span>
                </li>
            </ul>
             <ul class="list ">
                <li class="clearfix list_nobor">
                    <span class="left_span"></span><a href="{:U('User/find_pwd')}" class="sub_findpwd"><span class="right_span">忘记密码？点击找回</a></span>
                </li>
            </ul>
        </div>

        <!-- 弹出窗 -->
        <div class="dailog_mask"></div>
        <div class="dailog clearfix">
            <img src="__IMG__/img_2.png" alt="" class="closeBtn" >
            <h4>修改密码</h4>
            <p class="pwd">
                <input type="text"  class="pwd_text" placeholder="请输入原密码">
                <input name="password" id="password" value="" type="password" class="pwd_pwd">
            </p>
            <p class="pwd">
                <input type="text"  class="pwd_text" placeholder="请输入新密码">
                <input name="repassword" id="repassword" value="" type="password" class="pwd_pwd">
            </p>
            <p class="pwd">
                <input type="text" class="pwd_text" placeholder="请再次输入密码">
                <input name="repasswordtwo" id="repasswordtwo" value="" type="password" class="pwd_pwd">
            </p>
            <div class="info_btn clearfix">
                <input type="button" class="sub_form" value="确定" />
                <input type="button" value="取消" class="closeBtn quexiao" />
            </div>
        </div>
        <!--二维码弹出-->
        <div class="dailog_mask2"></div>
        <div class="dailog2" >
            <img src="__IMG__/img_2.png" alt="" class="closeBtn2" >
            <h4>二维码</h4>
            <p class="dialog2-pic" ><img src="http://qr.topscan.com/api.php?text={$share_url}" style="width:200px"></p>
        </div>
    </div>
    <block name="script">
        <script type="text/javascript">
            $(document).ready(function(){
                /*密码框*/
                $(".pwd").find(".pwd_text").focus(function() {
                    var text_value = $(this).val();
                    if (text_value == this.defaultValue) {
                        var obj=$(this).parent(".pwd")
                        $(this).hide();
                        obj.find(".pwd_pwd").show().focus();
                    }
                });
                $(".pwd_pwd").blur(function() {
                    var text_value = $(this).val();
                    if (text_value == "") {
                        var obj1=$(this).parent(".pwd")
                        $(this).hide();
                        obj1.find(".pwd_text").show();
                    }
                });

                // 弹出窗
                $(".list_reset").click(function(){
                    $(".dailog_mask").show();
                    $(".dailog").fadeIn(200);
                })
                $(".closeBtn").click(function(){
                    $(".dailog_mask").hide();
                    $(".dailog").fadeOut(200);
                })

                $(".list_reset2").click(function(){
                    $(".dailog_mask2").show();
                    $(".dailog2").fadeIn(200);
                });
                $(".closeBtn2").click(function(){
                    $(".dailog_mask2").hide();
                    $(".dailog2").fadeOut(200);
                });
            })
            //密码修改
            $('.sub_form').click(function(){
                var password=$('#password').val();
                var repassword=$("#repassword").val();
                var repasswordtwo=$('#repasswordtwo').val();
                if(password==''){alert('原密码不能为空');return false;};
                if(repassword==''){alert('新密码不能为空');return false;};
                if(repasswordtwo==''){alert('确认新密码不能为空');return false};
                if(repassword!=repasswordtwo){alert('密码不相同');return false}
                var url="{:U('User/reset_password')}";
                $.post(url,{
                    password:password,//表中验证自段
                    repassword:repassword,
                    repasswordtwo:repasswordtwo,
                },function(date){
                    if(date==1){alert('原密码出错')}
                    else if(date==2){alert('密码不相同')}
                    else if(date==3){alert('修改成功');
                        $(".dailog_mask").hide();
                        $(".dailog").fadeOut(200);
                    }
                    else if(date==4){alert('修改失败')}
                    else if(date==9){alert('原密码不能为空')}
                    else if(date==8){alert('新密码不能为空')}
                    else if(date==7){alert('确认新密码不能为空')}
                    else{return;}
                })
            })

        </script>
    </block>

</block>